from __future__ import annotations
from enum import Enum
from pydantic import BaseModel


class Lang(Enum):
    AUTO = ("Auto", "自动检测", False)
    ACH = ("Achinese", "亚齐语", False)
    AF = ("Afrikaans", "阿非利卡语", True)
    ALS = ("Tosk Albanian", "托斯克阿尔巴尼亚语", True)
    AM = ("Amharic", "阿姆哈拉语", True)
    AN = ("Aragonese", "阿拉贡语", True)
    AR = ("Arabic", "阿拉伯语", True)
    ARZ = ("Egyptian Arabic", "埃及阿拉伯语", True)
    AS = ("Assamese", "阿萨姆语", True)
    AST = ("Asturian", "阿斯图里亚斯语", True)
    AV = ("Avaric", "阿瓦尔语", True)
    AYM = ("Aymara", "艾马拉语", False)
    AZ = ("Azerbaijani", "阿塞拜疆语", True)
    AZB = ("South Azerbaijani", "南阿塞拜疆语", True)
    BA = ("Bashkir", "巴什基尔语", True)
    BAL = ("Balochi", "俾路支语", False)
    BAR = ("Bavarian", "巴伐利亚语", True)
    BCL = ("Central Bicolano", "中比科尔语", True)
    BE = ("Belarusian", "白俄罗斯语", True)
    BEM = ("Bemba", "本巴语", False)
    BER = ("Berber", "柏柏尔语", False)
    BG = ("Bulgarian", "保加利亚语", True)
    BH = ("Bihari", "比哈尔语", True)
    BHO = ("Bhojpuri", "博杰普尔语", False)
    BIS = ("Bislama", "比斯拉马语", False)
    BLI = ("Bilin", "比林语", False)
    BN = ("Bengali", "孟加拉语", True)
    BO = ("Tibetan", "藏语", True)
    BPY = ("Bishnupriya Manipuri", "比什奴普里亚马尼普尔语", True)
    BR = ("Breton", "布列塔尼语", True)
    BS = ("Bosnian", "波斯尼亚语", True)
    BXR = ("Buriat", "布里亚特语", True)
    CA = ("Catalan", "加泰罗尼亚语", True)
    CBK = ("Chavacano", "查瓦卡诺语", True)
    CE = ("Chechen", "车臣语", True)
    CEB = ("Cebuano", "宿务语", True)
    CHT = ("Chinese (Traditional)", "中文(繁体)", False)
    CHR = ("Cherokee", "切罗基语", False)
    CKB = ("Central Kurdish", "中库尔德语", True)
    CO = ("Corsican", "科西嘉语", True)
    CRE = ("Cree", "克里克语", False)
    CRI = ("Crimean Tatar", "克里米亚鞑靼语", False)
    CS = ("Czech", "捷克语", True)
    CV = ("Chuvash", "楚瓦什语", True)
    CY = ("Welsh", "威尔士语", True)
    DA = ("Danish", "丹麦语", True)
    DE = ("German", "德语", True)
    DIQ = ("Dimli", "丁米利语", True)
    DSB = ("Lower Sorbian", "低地索布语", True)
    DTY = ("Doteli", "多泰利语", True)
    DV = ("Divehi", "迪维希语", True)
    EL = ("Greek", "希腊语", True)
    EML = ("Emilian-Romagnol", "艾米利亚-罗马涅语", True)
    EN = ("English", "英语", True)
    ENO = ("Old English", "古英语", False)
    EO = ("Esperanto", "世界语", True)
    ES = ("Spanish", "西班牙语", True)
    ET = ("Estonian", "爱沙尼亚语", True)
    EU = ("Basque", "巴斯克语", True)
    FA = ("Persian", "波斯语", True)
    FAO = ("Faroese", "法罗语", False)
    FI = ("Finnish", "芬兰语", True)
    FIL = ("Filipino", "菲律宾语", False)
    FR = ("French", "法语", True)
    FRM = ("Middle French", "中古法语", False)
    FRI = ("Friulian", "弗留利语", False)
    FRN = ("Canadian French", "加拿大法语", False)
    FRR = ("Northern Frisian", "北弗里西亚语", True)
    FUL = ("Fulah", "富拉尼语", False)
    FY = ("Western Frisian", "西弗里西亚语", True)
    GA = ("Irish", "爱尔兰语", True)
    GD = ("Scottish Gaelic", "苏格兰盖尔语", True)
    GL = ("Galician", "加利西亚语", True)
    GN = ("Guarani", "瓜拉尼语", True)
    GOM = ("Goan Konkani", "果阿孔卡尼语", True)
    GRA = ("Ancient Greek", "古希腊语", False)
    GU = ("Gujarati", "古吉拉特语", True)
    GV = ("Manx", "马恩语", True)
    HAK = ("Hakka Chinese", "哈卡钦语", False)
    HAU = ("Hausa", "豪萨语", False)
    HAW = ("Hawaiian", "夏威夷语", False)
    HE = ("Hebrew", "希伯来语", True)
    HI = ("Hindi", "印地语", True)
    HIF = ("Fiji Hindi", "斐济印地语", True)
    HIL = ("Hiligaynon", "希利盖农语", False)
    HMN = ("Hmong", "苗语", False)
    HR = ("Croatian", "克罗地亚语", True)
    HSB = ("Upper Sorbian", "上索布语", True)
    HT = ("Haitian Creole", "海地克里奥尔语", True)
    HU = ("Hungarian", "匈牙利语", True)
    HUP = ("Hupa", "胡帕语", False)
    HY = ("Armenian", "亚美尼亚语", True)
    IA = ("Interlingua", "国际语A", True)
    IBO = ("Igbo", "伊博语", False)
    ID = ("Indonesian", "印度尼西亚语", True)
    IE = ("Interlingue", "国际语E", True)
    IKU = ("Inuktitut", "伊努克提图特语", False)
    ILO = ("Iloko", "伊洛科语", True)
    ING = ("Ingush", "印古什语", False)
    IO = ("Ido", "伊多语", True)
    IS = ("Icelandic", "冰岛语", True)
    IT = ("Italian", "意大利语", True)
    IU = ("Inuktitut", "因纽特语", False)
    JA = ("Japanese", "日语", True)
    JBO = ("Lojban", "逻辑语", True)
    JV = ("Javanese", "爪哇语", True)
    KA = ("Georgian", "格鲁吉亚语", True)
    KAB = ("Kabyle", "卡拜尔语", False)
    KAH = ("Kashubian", "卡舒比语", False)
    KAL = ("Greenlandic", "格陵兰语", False)
    KAS = ("Kashmiri", "克什米尔语", False)
    KAU = ("Kanuri", "卡努里语", False)
    KIN = ("Kinyarwanda", "卢旺达语", False)
    KK = ("Kazakh", "哈萨克语", True)
    KLI = ("Klingon", "克林贡语", False)
    KM = ("Khmer", "高棉语", True)
    KN = ("Kannada", "卡纳达语", True)
    KO = ("Korean", "韩语", True)
    KON = ("Kongo", "刚果语", False)
    KRC = ("Karachay-Balkar", "卡拉恰伊-巴尔卡尔语", True)
    KU = ("Kurdish", "库尔德语", True)
    KV = ("Komi", "科米语", True)
    KW = ("Cornish", "康沃尔语", True)
    KY = ("Kyrgyz", "吉尔吉斯语", True)
    LA = ("Latin", "拉丁语", True)
    LAG = ("Latgalian", "拉特加莱语", False)
    LB = ("Luxembourgish", "卢森堡语", True)
    LEZ = ("Lezgian", "列兹金语", True)
    LI = ("Limburgish", "林堡语", True)
    LIN = ("Lingala", "林加拉语", False)
    LMO = ("Lombard", "伦巴第语", True)
    LO = ("Lao", "老挝语", True)
    LRC = ("Northern Luri", "北卢尔语", True)
    LT = ("Lithuanian", "立陶宛语", True)
    LUG = ("Ganda", "卢干达语", False)
    LV = ("Latvian", "拉脱维亚语", True)
    MAH = ("Marshallese", "马绍尔语", False)
    MAI = ("Maithili", "迈蒂利语", True)
    MAO = ("Maori", "毛利语", False)
    MAU = ("Mauritian Creole", "毛里求斯克里奥尔语", False)
    MG = ("Malagasy", "马达加斯加语", True)
    MHR = ("Eastern Mari", "东马里语", True)
    MIN = ("Minangkabau", "米南加保语", True)
    MK = ("Macedonian", "马其顿语", True)
    ML = ("Malayalam", "马拉雅拉姆语", True)
    MN = ("Mongolian", "蒙古语", True)
    MOT = ("Montenegrin", "黑山语", False)
    MR = ("Marathi", "马拉地语", True)
    MRJ = ("Western Mari", "西马里语", True)
    MS = ("Malay", "马来语", True)
    MT = ("Maltese", "马耳他语", True)
    MWL = ("Mirandese", "米兰德斯语", True)
    MY = ("Burmese", "缅甸语", True)
    MYV = ("Erzya", "厄尔兹亚语", True)
    MZN = ("Mazanderani", "马赞德兰语", True)
    NAH = ("Nahuatl", "纳瓦特尔语", True)
    NAP = ("Neapolitan", "那不勒斯语", True)
    NBL = ("Southern Ndebele", "南恩德贝莱语", False)
    NDS = ("Low German", "低地德语", True)
    NE = ("Nepali", "尼泊尔语", True)
    NEW = ("Newar", "纽瓦尔语", True)
    NL = ("Dutch", "荷兰语", True)
    NN = ("Norwegian Nynorsk", "新挪威语", True)
    NO = ("Norwegian", "挪威语", True)
    NOB = ("Norwegian Bokmål", "书面挪威语", False)
    NQO = ("N'Ko", "西非书面语", False)
    NYA = ("Chichewa", "齐切瓦语", False)
    OC = ("Occitan", "奥克西坦语", True)
    OJI = ("Ojibwa", "奥杰布瓦语", False)
    OR = ("Oriya", "奥里亚语", True)
    ORM = ("Oromo", "奥罗莫语", False)
    OS = ("Ossetian", "奥塞梯语", True)
    PA = ("Punjabi", "旁遮普语", True)
    PAP = ("Papiamento", "帕皮阿门托语", False)
    PAM = ("Kapampangan", "邦板牙语", True)
    PED = ("Northern Sotho", "北索托语", False)
    PFL = ("Palatine German", "普法尔茨德语", True)
    PL = ("Polish", "波兰语", True)
    PMS = ("Piedmontese", "皮埃蒙特语", True)
    PNB = ("Western Punjabi", "西旁遮普语", True)
    POT = ("Brazilian Portuguese", "巴西葡萄牙语", False)
    PRS = ("Persian (Afghanistan)", "波斯语(阿富汗)", False)
    PS = ("Pashto", "普什图语", True)
    PT = ("Portuguese", "葡萄牙语", True)
    PTT = ("Portuguese (Portugal)", "葡萄牙语(葡萄牙)", False)
    QU = ("Quechua", "克丘亚语", True)
    RM = ("Romansh", "罗曼什语", True)
    RMI = ("Romani", "罗姆语", False)
    RO = ("Romanian", "罗马尼亚语", True)
    RU = ("Russian", "俄语", True)
    RUE = ("Rusyn", "鲁塞尼亚语", True)
    SA = ("Sanskrit", "梵语", True)
    SAH = ("Yakut", "雅库特语", True)
    SC = ("Sardinian", "撒丁语", True)
    SCN = ("Sicilian", "西西里语", True)
    SCO = ("Scots", "苏格兰语", True)
    SD = ("Sindhi", "信德语", True)
    SH = ("Serbo-Croatian", "塞尔维亚-克罗地亚语", True)
    SHA = ("Shan", "掸语", False)
    SI = ("Sinhala", "僧伽罗语", True)
    SIL = ("Silesian", "西里西亚语", False)
    SK = ("Slovak", "斯洛伐克语", True)
    SL = ("Slovenian", "斯洛文尼亚语", True)
    SM = ("Samoan", "萨摩亚语", False)
    SME = ("Northern Sami", "北方萨米语", False)
    SNA = ("Shona", "修纳语", False)
    SO = ("Somali", "索马里语", True)
    SOL = ("Songhai", "桑海语", False)
    SOT = ("Southern Sotho", "南索托语", False)
    SQ = ("Albanian", "阿尔巴尼亚语", True)
    SR = ("Serbian", "塞尔维亚语", True)
    SRC = ("Serbian (Cyrillic)", "塞尔维亚语（西里尔）", False)
    SRL = ("Serbian (Latin)", "塞尔维亚语(拉丁文)", False)
    SU = ("Sundanese", "巽他语", True)
    SV = ("Swedish", "瑞典语", True)
    SW = ("Swahili", "斯瓦希里语", True)
    SYR = ("Syriac", "叙利亚语", False)
    TA = ("Tamil", "泰米尔语", True)
    TE = ("Telugu", "泰卢固语", True)
    TET = ("Tetum", "德顿语", False)
    TG = ("Tajik", "塔吉克语", True)
    TH = ("Thai", "泰语", True)
    TIR = ("Tigrinya", "提格利尼亚语", False)
    TK = ("Turkmen", "土库曼语", True)
    TL = ("Tagalog", "塔加洛语", True)
    TO = ("Tonga", "汤加语", False)
    TR = ("Turkish", "土耳其语", True)
    TSO = ("Tsonga", "聪加语", False)
    TT = ("Tatar", "鞑靼语", True)
    TUA = ("Tunisian Arabic", "突尼斯阿拉伯语", False)
    TWI = ("Twi", "契维语", False)
    TYV = ("Tuvinian", "图瓦语", True)
    UG = ("Uyghur", "维吾尔语", True)
    UK = ("Ukrainian", "乌克兰语", True)
    UR = ("Urdu", "乌尔都语", True)
    UZ = ("Uzbek", "乌兹别克语", True)
    VEC = ("Venetian", "威尼斯语", True)
    VEN = ("Venda", "文达语", False)
    VEP = ("Veps", "维普斯语", True)
    VI = ("Vietnamese", "越南语", True)
    VLS = ("West Flemish", "西弗拉芒语", True)
    VO = ("Volapük", "沃拉普克语", True)
    WA = ("Walloon", "瓦隆语", True)
    WAR = ("Waray", "瓦拉伊语", True)
    WOL = ("Wolof", "沃洛夫语", False)
    WUU = ("Wu Chinese", "吴语", True)
    WYW = ("Classical Chinese", "中文(文言文)", False)
    XAL = ("Kalmyk", "卡尔梅克语", True)
    XHO = ("Xhosa", "科萨语", "xho")
    XMF = ("Mingrelian", "明格列尔语", True)
    YI = ("Yiddish", "意第绪语", True)
    YO = ("Yoruba", "约鲁巴语", True)
    YUE = ("Cantonese", "中文.粤语", True)
    ZAZ = ("Zazaki", "扎扎其语", False)
    ZH = ("Chinese", "中文", True)
    ZUL = ("Zulu", "祖鲁语", False)

    def __init__(self, en_name: str, cn_name: str, is_support_language: bool = True):
        self.en_name = en_name
        self.cn_name = cn_name
        self.is_support_language = is_support_language

    @staticmethod
    def of(str: str) -> Lang:
        try:
            return Lang[str.upper()]
        except KeyError:
            raise ValueError(f"无效的语言: {str}")
